﻿<!DOCTYPE html>
<html>
<head>
    <title>amap example</title>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="http://cache.amap.com/lbs/static/main1119.css"/>
    <script src="http://webapi.amap.com/maps?v=1.4.2&key=6cb85da518029607d421917b7ddeb94a"></script>
    <style>
        html, body, #map {
            height: 100%;
            padding: 0;
            margin: 0;
        }
    </style>
</head>
<body>
<div id="map"></div>
<script src="../../build/mapv.js"></script>
<script>

    var map = new AMap.Map('map', {
        resizeEnable: true,
        zoom: 4,
        center: [-102.17609405517578, 34.41583177128595],
        mapStyle: 'amap://styles/dark'
    });
    AMap.plugin(["AMap.ControlBar"], function () {
        var bar = new AMap.ControlBar();
        map.addControl(bar);
    });

    var randomCount = 500;
    var data = [];
    while (randomCount--) {
        data.push({
            geometry: {
                type: 'Point',
                coordinates: [-125.8 + Math.random() * 50, 30.3 + Math.random() * 20]
            },
            count: 30 * Math.random()
        });
    }

    var dataSet = new mapv.DataSet(data);

    var options = {
        max: 30, // 设置显示的权重最大值
        type: 'circle', // 点形状,可选circle:圆形(默认),rect:矩形
        size: 10, // 半径大小
        maxOpacity: 0.9,
        gradient: { // 显示的颜色渐变范围
            '0': 'blue',
            '0.6': 'cyan',
            '0.7': 'lime',
            '0.8': 'yellow',
            '1.0': 'red'
        },
        draw: 'heatmap',
        zooms: [0, 22],
        methods: {
            click: function (event) {
                console.log(event)
            },
            mousemove: function (event) {
                console.log(event)
            }
        }
    }

    var mapvLayer = new mapv.AMapLayer(map, dataSet, options);

</script>
</body>
</html>
